<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('产品列表')"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>

                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<script th:inline="javascript">
    var prefix = ctx + "activity/product";

    $(function () {
        var options = {
            url: prefix + "/selectProduct",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            // clickToSelect: true,
            // rememberSelected: true,
            modalName: "福禄商品",
            columns: [{
                field: 'state',
                radio: true
            },
            {
                field : 'productId',
                title : '商品Id'
            },
            {
                field : 'productName',
                title : '商品名称'
            },
            {
                field : 'productType',
                title : '库存类型'
            },
            {
                field : 'faceValue',
                title : '面值'
            },
            {
                field : 'purchasePrice',
                title : '单价'
            },
            {
                field : 'salesStatus',
                title : '销售状态'
            },
            {
                field : 'stockStatus',
                title : '库存状态'
            },
            {
                field : 'details',
                title : '商品详情'
            },
            {
                field : 'templateId',
                title : '商品模板Id',
                visible: false
            },
            {
                field : 'fourCategoryIcon',
                title : '四级分类图标',
                visible: false
            }
            ]
        };
        $.table.init(options);
    });


    /* 选择商品-提交 */
    function submitHandler() {
        let rows = $.table.selectColumns("productId");
        if (rows.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.close();
        // 父页面的输入框
        parent.$("input[name='productId']").val(rows.join(','));
    }
</script>
</body>
</html>